package com.controller;

import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import com.loader.ConfigLoader;
import com.runner.DdmapSite;
import com.runner.Site;

public class CrawlController {

	public static void main(String[] args) {
		ConfigLoader loader = new ConfigLoader();
//		
		Map<String, Map<String, String>> sitesMap = loader.loadConfigInfo("files/BBSFilter.xml");
//		ExecutorService exec = Executors.newFixedThreadPool(10);
		for (String key : sitesMap.keySet()) {
			Map<String, String> map = sitesMap.get(key);
			//0：抓取当日数据  1：抓取历史数据  2:抓取指定网页数据
			Site site = new DdmapSite(map,0);
			new Thread(site).start();
//			exec.execute(new Site(map,0));
		}
//		
//		exec.shutdown();
//		
//		while (!exec.isTerminated()) {
//			try {
//				TimeUnit.SECONDS.sleep(2);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
//		}
//		
		
	}

}
